from dataclasses import dataclass, field
from typing import Optional, List, Dict, Any


@dataclass
class ModelConfig:
    """模型配置"""
    model: str
    tokenizer: str
    trust_remote_code: bool = False
    dtype: str = "auto"
    seed: int = 0


@dataclass
class CacheConfig:
    """缓存配置"""
    block_size: int = 16
    gpu_memory_utilization: float = 0.9
    num_gpu_blocks: Optional[int] = None
    num_cpu_blocks: Optional[int] = None


@dataclass
class ParallelConfig:
    """并行配置"""
    tensor_parallel_size: int = 1
    pipeline_parallel_size: int = 1
    worker_use_ray: bool = False


@dataclass
class SchedulerConfig:
    """调度器配置"""
    max_num_seqs: int = 256
    max_num_batched_tokens: int = 8192
    max_model_len: int = 4096


@dataclass
class SamplingConfig:
    """采样配置"""
    temperature: float = 1.0
    top_p: float = 1.0
    top_k: int = -1
    max_tokens: int = 2048